package com.ruoyi.lm.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.lm.domain.LmUserinvention;
import com.ruoyi.lm.service.ILmUserinventionService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 邀请好友Controller
 * 
 * @author ruoyi
 * @date 2020-09-02
 */
@Controller
@RequestMapping("/phone/lm/userinvention")
public class LmUserinventionControllerPhone extends BaseController
{

    @Autowired
    private ILmUserinventionService lmUserinventionService;

    /**
     * 查询邀请好友列表
     */
    @PostMapping("/listByUserId")
    @ResponseBody
    public TableDataInfo listByUserId(String userId)
    {
        LmUserinvention lmUserinvention = new LmUserinvention();
        lmUserinvention.setUserId(userId);
        List<LmUserinvention> list = lmUserinventionService.selectLmUserinventionList(lmUserinvention);
        return getDataTable(list);
    }
    /**
     * 新增保存邀请好友
     */
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(LmUserinvention lmUserinvention)
    {
        return toAjax(lmUserinventionService.insertLmUserinvention(lmUserinvention));
    }
}
